From 899c0f08406c0cb302465cda2e8dfea90c3afe01 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Tue, 17 May 2005 22:15:17 +0000 Subject: [PATCH] bitkeeper revision 1.1439 (428a6cf5pJzUJXByrppn04a8boHuAw) Fix virq delivery in Xend. xcs.c: Fix binding to virq's -- setup evtchn binding. channel.py: Use VIRQ_DOM_EXC as exported from xc. Also don't bind to virq's we don't care for or which won't get delivered to us anyway. xc.c: Export VIRQ_DOM_EXC to python. Signed-off-by: Christian Limpach --- tools/python/xen/lowlevel/xc/xc.c | 1 + tools/python/xen/xend/server/channel.py | 16 +++------------- tools/xcs/xcs.c | 11 +++++++++++ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index a7b4aba7c6..d77540803a 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -1279,6 +1279,7 @@ PyMODINIT_FUNC initxc(void) d = PyModule_GetDict(m); xc_error = PyErr_NewException(XENPKG ".error", NULL, NULL); PyDict_SetItemString(d, "error", xc_error); + PyDict_SetItemString(d, "VIRQ_DOM_EXC", PyInt_FromLong(VIRQ_DOM_EXC)); zero = PyInt_FromLong(0); diff --git a/tools/python/xen/xend/server/channel.py b/tools/python/xen/xend/server/channel.py index d60c206382..f02c772ac6 100755 --- a/tools/python/xen/xend/server/channel.py +++ b/tools/python/xen/xend/server/channel.py @@ -10,12 +10,6 @@ from xen.xend.XendLogging import log from messages import * -VIRQ_MISDIRECT = 0 # Catch-all interrupt for unbound VIRQs. -VIRQ_TIMER = 1 # Timebase update, and/or requested timeout. -VIRQ_DEBUG = 2 # Request guest to dump debug info. -VIRQ_CONSOLE = 3 # (DOM0) bytes received on emergency console. -VIRQ_DOM_EXC = 4 # (DOM0) Exceptional event for some domain. - DEBUG = 0 RESPONSE_TIMEOUT = 20.0 @@ -66,13 +60,8 @@ class ChannelFactory: def __init__(self): """Constructor - do not use. Use the channelFactory function.""" self.notifier = xu.notifier() - # Register interest in all virqs. - # Unfortunately virqs do not seem to be delivered. - self.bind_virq(VIRQ_MISDIRECT) - self.bind_virq(VIRQ_TIMER) - self.bind_virq(VIRQ_DEBUG) - self.bind_virq(VIRQ_CONSOLE) - self.bind_virq(VIRQ_DOM_EXC) + # Register interest in virqs. + self.bind_virq(xen.lowlevel.xc.VIRQ_DOM_EXC) self.virqHandler = None def bind_virq(self, virq): @@ -81,6 +70,7 @@ class ChannelFactory: log.info("Virq %s on port %s", virq, port) def virq(self): + log.error("virq") self.notifier.virq_send(self.virqPort) def start(self): diff --git a/tools/xcs/xcs.c b/tools/xcs/xcs.c index 9fb257a433..f865d5d977 100644 --- a/tools/xcs/xcs.c +++ b/tools/xcs/xcs.c @@ -192,10 +192,21 @@ control_channel_t *add_virq(int virq) cc = (control_channel_t *)malloc(sizeof(control_channel_t)); if ( cc == NULL ) return NULL; + memset(cc, 0, sizeof(control_channel_t)); cc->type = CC_TYPE_VIRQ; cc->local_port = virq_port; cc->virq = virq; + cc->ref_count = 1; + if (evtchn_bind(cc->local_port) != 0) + { + DPRINTF("Got control interface, but couldn't bind evtchan!\n"); + free(cc); + return NULL; + } + + cc_list[cc->local_port] = cc; + return cc; } -- 2.30.2